import { createApp } from 'vue'
import { createPinia } from 'pinia'
import { createRouter, createWebHistory } from 'vue-router'
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/reset.css'
import './style.css'
import App from './App.vue'
import { routes } from './router/routes'
import { setupRouterGuard } from './router/guard'

// 创建路由实例
const router = createRouter({
  history: createWebHistory(),
  routes
})

// 创建 pinia 实例
const pinia = createPinia()

const app = createApp(App)

// 注册插件
app.use(router)
app.use(pinia)
app.use(Antd)

// 设置路由守卫
setupRouterGuard(router)

app.mount('#app')
